package org.zky.modules.account.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import lombok.Data;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.sql.Timestamp;

/**
* @author chenglong
* @date 2020-03-23
*/
@Entity
@Data
@Table(name="zky_account_role_tab")
public class ZkyAccountRoleTab implements Serializable {

    @Id
    @Column(name = "account_id")
    private Long accountId;

    @Id
    @Column(name = "role_id")
    private Long roleId;

    /** delete time */
    @Id
    @Column(name = "delete_at")
    private Integer deleteAt;

    @Column(name = "create_time",nullable = false)
    @NotNull
    private Timestamp createTime;

    @Column(name = "update_time",nullable = false)
    @NotNull
    private Timestamp updateTime;

    public void copy(ZkyAccountRoleTab source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}